nums=[3,2,2]
def thirdMax(nums):
    #排序
    nums.sort(reverse=True)
    print(nums)
    index,count=0,0
    while index<len(nums):
        if index==0:
            count+=1
        if index>0:
            if nums[index-1]==nums[index]:
                #count保持不变
                index+=1
                continue
            else:
                count+=1
                if count==3:
                    return nums[index]
        index+=1
    return nums[0]
print(thirdMax(nums))
